﻿using JobBack.Models;
using QG.JobBack.BLL.IService;
using QH.JobBack.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QG.JobBack.UI.Attributes;
using QG.JobBack.DAL;

namespace JobBack.Controllers
{

    public class LogsController : Controller
    {
        private ILogsService ilogservice;

        
        public LogsController(ILogsService @LogsService)
        {
            ilogservice = @LogsService;
        }
        /// <summary>
        /// 日志管理页面
        /// </summary>
        /// <returns></returns>
        [Describe("查看日志")]
        public ActionResult LogsManager()
        {
            return View();
        }

        //日志表格显示
        public JsonResult LogsTableShow(int page, int limit,Nullable<int> RoidId, Nullable<DateTime> BeginTime)
        {
            List<LogsBase> logs = ilogservice.QueryLogsAll(RoidId, BeginTime);
               
            
            ResponseResult<LogsBase> getJson = new ResponseResult<LogsBase>()
            {
                msg = "",
                code = 0,
                count = logs.Count,
                data = logs.Skip((page - 1) * limit).Take(limit).ToList()
            };
            return Json(getJson, JsonRequestBehavior.AllowGet);
        }

    }
}